﻿using App.Extension;

/*********************************************************
 * 命名空间 App
 * 接口名称 ReplyDevice
 * 开发人员：11920
 * 创建时间：2023/4/14 17:11:36
 * 描述说明：
 * 更改历史：
 * 
 * *******************************************************/
namespace App
{
	public static class ReplyDevice
	{
		public static byte[] ErrorReply(int CommandStatus, byte commandId = 0)
		{
			byte[] data = new byte[7];
			Array.Copy(Common.Head, 0, data, 0, 2);
			data[2] = commandId;
			data[3] = (byte)(CommandStatus & 0xFF);
			data[data.Length - 3] = (byte)data.CalculateChecksum(data.Length - 3);
			//Array.Copy(BitConverter.GetBytes(CalculateChecksum(data, data.Length - 3)), 0, data, , 1);
			Array.Copy(Common.Tail, 0, data, data.Length - 2, 2);
			return data;
		}
	}
}
